﻿CREATE TABLE [dbo].[user_Editor] (
    [Id]         UNIQUEIDENTIFIER CONSTRAINT [DF_user_Editor_Id] DEFAULT (newid()) NOT NULL,
    [UserId]     UNIQUEIDENTIFIER NOT NULL,
    [BookTreeId] BIGINT           NOT NULL,
    [Edit]       BIT              NOT NULL,
    CONSTRAINT [PK_Id] PRIMARY KEY CLUSTERED ([Id] ASC),
    CONSTRAINT [FK_user_Editor_text_BookTree] FOREIGN KEY ([BookTreeId]) REFERENCES [dbo].[text_BookTree] ([BookTreeId]),
    CONSTRAINT [FK_user_Editor_user_User] FOREIGN KEY ([UserId]) REFERENCES [dbo].[user_User] ([UserId])
);



GO
CREATE NONCLUSTERED INDEX [IX_user_Editor_UserId]
    ON [dbo].[user_Editor]([UserId] ASC);


GO
CREATE NONCLUSTERED INDEX [IX_user_Editor_BookTreeId]
    ON [dbo].[user_Editor]([BookTreeId] ASC);

